﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using System.Data;
using GtsServer.Common;

namespace GtsServer.Manage.Controller
{
    public class CommunicationReportController
    {
        public List<CommunicationReport> GetList(int pageIndex, int pageSize, int pid, string start, string end, out int count)
        {
            CommunicationReportDAL dal = new CommunicationReportDAL();

            string strWhere = " 1=1 ";
            if (pid > 0)
                strWhere += " and Pid=" + pid;
            if (!string.IsNullOrEmpty(start))
                strWhere += " and ReportTime>='" + start + "'";
            if (!string.IsNullOrEmpty(end))
                strWhere += " and ReportTime<='" + end + "'";
            count = 0;
            DataSet ds = dal.GetList(pageIndex, pageSize, strWhere);
            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
            return IListDataSet.DataSetToIList<CommunicationReport>(ds, 0).ToList();
        }
    }
}
